package synchandler

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"github.com/spf13/viper"
	"io/ioutil"
	"log"
	"time"
	"yundian/internel/app/logic"
	"yundian/internel/app/models/prices"
	"yundian/internel/pkg/dingo"
	"yundian/internel/pkg/dingo/global"
	. "yundian/internel/pkg/dingo/result"
)

// 同步商户、代理商
func UpdateUsers(ctx *gin.Context) {
	var strs []string
	var err error
	param := &struct {
		Cookie string `json:"cookie"`
	}{}
	dingo.ErrorIf(ctx.ShouldBindJSON(param)).Unwrap()
	if param.Cookie == "" {
		Response(ctx)("Cookie不能为空", CodeError, strs)(Error)
		return
	}
	strs, err = logic.NewSyncLogic().UpdateUsersLogic(1, 3500, param.Cookie)
	if err != nil {
		Response(ctx)("更新失败"+err.Error(), CodeError, strs)(Error)
		return
	}
	if len(strs) > 0 {
		Response(ctx)("更新成功", CodeSuccess, strs)(OK)
	}
}

func GetThUsers(cookie string) {

	logic.NewSyncLogic().UpdateUsersLogic(1, 3000, cookie)

}

func GetYCUsers(cookie string) {

	logic.NewSyncLogic().UpdateYCUsersLogic(1, 3000, cookie)

}

// 同步商户的openid
func UpdateUsersOpenid() {
	// 获取用户
	logic.NewSyncLogic().UpdateUsersOpenId("JSESSIONID=node01nk00btl83e7ab41i1yb52d7k3.node0")
}

func UpdateOrders(ctx *gin.Context) {
	var strs []string
	var err error
	param := &struct {
		Cookie string `json:"cookie"`
	}{}
	dingo.ErrorIf(ctx.ShouldBindJSON(param)).Unwrap()
	if param.Cookie == "" {
		Response(ctx)("Cookie不能为空", CodeError, strs)(Error)
		return
	}
	strs, err = logic.NewSyncLogic().UpdateOrdersLogic(20, 3000, param.Cookie)
	if err != nil {
		Response(ctx)("更新失败"+err.Error(), CodeError, strs)(Error)
		return
	}
	if len(strs) > 0 {
		Response(ctx)("更新成功", CodeSuccess, strs)(OK)
	}
}

func UpdateOrdersTake(ctx *gin.Context) {
	var strs []string
	var err error
	param := &struct {
		Cookie string `json:"cookie"`
	}{}
	dingo.ErrorIf(ctx.ShouldBindJSON(param)).Unwrap()
	if param.Cookie == "" {
		Response(ctx)("Cookie不能为空", CodeError, strs)(Error)
		return
	}
	strs, err = logic.NewSyncLogic().UpdateOrdersTakeLogic(20, 3000, param.Cookie)
	if err != nil {
		Response(ctx)("更新失败"+err.Error(), CodeError, strs)(Error)
		return
	}
	if len(strs) > 0 {
		Response(ctx)("更新成功", CodeSuccess, strs)(OK)
	}
}

func UpdateOrdersToSql() {
	var strs []string
	var err error

	strs, err = logic.NewSyncLogic().UpdateOrdersTosqlLogic(18)
	if err != nil {
		//Response(context.Background())("更新失败" + err.Error(), CodeError, strs)(Error)
		log.Println(strs)
		return
	}
	if len(strs) > 0 {
		//Response()("更新成功", CodeSuccess, strs)(OK)
		log.Println(strs)
	}
}

//func UpdateTakeOrders(ctx *gin.Context)  {
//	var strs []string
//	var err error
//	param := &struct {
//		Cookie string `json:"cookie"`
//	}{}
//	dingo.ErrorIf(ctx.ShouldBindJSON(param)).Unwrap()
//	if param.Cookie == "" {
//		Response(ctx)("Cookie不能为空", CodeError, strs)(Error)
//		return
//	}
//	strs,err = logic.NewSyncLogic().UpdateTabkeOrdersLogic(30, 3000, param.Cookie)
//	if err != nil {
//		Response(ctx)("更新失败" + err.Error(), CodeError, strs)(Error)
//		return
//	}
//	if len(strs) > 0 {
//		Response(ctx)("更新成功", CodeSuccess, strs)(OK)
//	}
//}
//
func UpdateTakeOrdersToSql() {
	var strs []string
	var err error

	strs, err = logic.NewSyncLogic().UpdateTakeOrdersTosqlLogic(18)
	if err != nil {
		//Response(context.Background())("更新失败" + err.Error(), CodeError, strs)(Error)
		log.Println(strs)
		return
	}
	if len(strs) > 0 {
		//Response()("更新成功", CodeSuccess, strs)(OK)
		log.Println(strs)
	}
}

func OrdersToSql(ctx *gin.Context) {
	var count int64
	for i := 1; i <= 20; i++ {
		var lists []ordertoSql
		global.Orm.Table("ordersth").Find(&lists)

		for _, lst := range lists {
			//log.Println(lst)
			if lst.TradeNo != "" {
				global.Orm.Table("orders").Create(lst)
				count++
			}
		}
	}

	Response(ctx)("更新成功", CodeSuccess, count)(OK)
}

func OrdersToMysql() {
	var count int64
	var lists []ordertoSql
	global.Orm.Table("ordersth").Find(&lists)

	for _, lst := range lists {
		//log.Println(lst)
		if lst.TradeNo != "" {
			global.Orm.Table("orders").Create(lst)
			count++
		}
	}

	log.Println(count)
}

func UpdateDividends(ctx *gin.Context) {
	var strs []string
	var err error
	param := &struct {
		Cookie string `json:"cookie"`
	}{}
	dingo.ErrorIf(ctx.ShouldBindJSON(param)).Unwrap()
	if param.Cookie == "" {
		Response(ctx)("Cookie不能为空", CodeError, strs)(Error)
		return
	}
	strs, err = logic.NewSyncLogic().UpdateDividendsLogic(1, 3500, param.Cookie)
	if err != nil {
		Response(ctx)("更新失败"+err.Error(), CodeError, strs)(Error)
		return
	}
	if len(strs) > 0 {
		Response(ctx)("更新成功", CodeSuccess, strs)(OK)
	}
}

func UpdateDevices(ctx *gin.Context) {
	var strs []string
	var err error
	param := &struct {
		Cookie string `json:"cookie"`
	}{}
	dingo.ErrorIf(ctx.ShouldBindJSON(param)).Unwrap()
	if param.Cookie == "" {
		Response(ctx)("Cookie不能为空", CodeError, strs)(Error)
		return
	}
	strs, err = logic.NewSyncLogic().UpdateDeviceLogic(21, 3000, param.Cookie)
	if err != nil {
		Response(ctx)("更新失败"+err.Error(), CodeError, strs)(Error)
		return
	}
	if len(strs) > 0 {
		Response(ctx)("更新成功", CodeSuccess, strs)(OK)
	}
}

func GetDeviceList(cookie string) {
	logic.NewSyncLogic().UpdateDeviceLogic(25, 3000, cookie)
}

func GetYCDeviceList(cookie string) {
	logic.NewSyncLogic().UpdateYCDeviceLogic(22, 3000, cookie)
}

//网点信息

func GetYCPlacesList(cookie string) {
	//logic.NewSyncLogic().UpdateYCPlacesLogic(2, 3000, cookie)
}

func ImportYCPlaces(page int, path string) {
	//errStr := logic.NewSyncLogic().DoTaskPlaces(page, path)
	//fmt.Println(errStr)
}

func GetSCPlacesList(cookie string) {
	//logic.NewSyncLogic().UpdateSCPlacesLogic(2, 3000, cookie)
}

func ImportSCPlaces(page int, path string) {
	//errStr := logic.NewSyncLogic().DoTaskPlaces(page, path)
	//fmt.Println(errStr)
}

func ImportSCDevice(page int, path string) {
	//errStr := logic.NewSyncLogic().TaskSCDevices(page, path)
	//fmt.Println(errStr)
}

func ImportYCDevice(page int, path string) {
	//errStr := logic.NewSyncLogic().TaskYCDevices(page, path)
	//fmt.Println(errStr)
}

//导入抽单策略
func ImportPloys(page int, path string) {
	//errStr := logic.NewSyncLogic().TaskPloys(page, path)
	//fmt.Println(errStr)
}

func UpdateMembers(ctx *gin.Context) {
	var strs []string
	var err error
	param := &struct {
		Cookie string `json:"cookie"`
	}{}
	dingo.ErrorIf(ctx.ShouldBindJSON(param)).Unwrap()
	if param.Cookie == "" {
		Response(ctx)("Cookie不能为空", CodeError, strs)(Error)
		return
	}
	strs, err = logic.NewSyncLogic().UpdateMemberLogic(2, 3000, param.Cookie)
	if err != nil {
		Response(ctx)("更新失败"+err.Error(), CodeError, strs)(Error)
		return
	}
	if len(strs) > 0 {
		Response(ctx)("更新成功", CodeSuccess, strs)(OK)
	}
}

// 手动发起日统计
func HandelOrderStatistics(ctx *gin.Context) {
	// 获取参数
	param := &struct {
		StatiTime string `json:"statiTime" form:"statiTime"` // 统计日期
	}{}
	dingo.ErrorIf(ctx.ShouldBindJSON(param)).Unwrap()

	log.Println("hahaha: ", param.StatiTime)

	//currDate,_ := time.Parse("20060102",param.StatiTime)

	logic.NewTaskLogic().UpdateOrderStatistics(param.StatiTime)
}

func UpdateCash(ctx *gin.Context) {
	var strs []string
	var err error
	param := &struct {
		Cookie string `json:"cookie"`
	}{}
	dingo.ErrorIf(ctx.ShouldBindJSON(param)).Unwrap()
	if param.Cookie == "" {
		Response(ctx)("Cookie不能为空", CodeError, strs)(Error)
		return
	}
	strs, err = logic.NewSyncLogic().UpdateCashLogic(1, 3000, param.Cookie)
	if err != nil {
		Response(ctx)("更新失败"+err.Error(), CodeError, strs)(Error)
		return
	}
	if len(strs) > 0 {
		Response(ctx)("更新成功", CodeSuccess, strs)(OK)
	}
}

func UpdatePrices(ctx *gin.Context) {
	var strs []string
	var err error
	param := &struct {
		Cookie string `form:"cookie"`
	}{}
	dingo.ErrorIf(ctx.ShouldBindQuery(param)).Unwrap()
	if param.Cookie == "" {
		Response(ctx)("Cookie不能为空", CodeError, strs)(Error)
		return
	}
	strs, err = logic.NewSyncLogic().UpdatePricesLogic(10, param.Cookie)
	if err != nil {
		Response(ctx)("更新失败"+err.Error(), CodeError, strs)(Error)
		return
	}
	if len(strs) > 0 {
		Response(ctx)("更新成功", CodeSuccess, strs)(OK)
	}
}

func UpdateUserPrices(cookie string)  {
	//var strs []string
	//var err error
	//param := &struct {
	//	Cookie string `form:"cookie"`
	//}{}
	//dingo.ErrorIf(ctx.ShouldBindQuery(param)).Unwrap()
	//if param.Cookie == "" {
	//	Response(ctx)("Cookie不能为空", CodeError, strs)(Error)
	//	return
	//}
	//strs,err = logic.NewSyncLogic().UpdatePricesLogic(13, cookie)
	//if err != nil {
	//	Response(ctx)("更新失败" + err.Error(), CodeError, strs)(Error)
	//	return
	//}
	//if len(strs) > 0 {
	//	Response(ctx)("更新成功", CodeSuccess, strs)(OK)
	//}

	logic.NewSyncLogic().UpdatePricesLogic(13, cookie)
}

// 抓取天海-用户详情页面（总分成金额、可提现金额、已提现）
func UpdateUserInfoCount(ctx *gin.Context) {
	var strs []string
	var err error
	param := &struct {
		Cookie string `form:"cookie"`
	}{}
	dingo.ErrorIf(ctx.ShouldBindQuery(param)).Unwrap()
	if param.Cookie == "" {
		Response(ctx)("Cookie不能为空", CodeError, strs)(Error)
		return
	}
	strs, err = logic.NewSyncLogic().UpdateUserInfoCountLogic(param.Cookie)
	if err != nil {
		Response(ctx)("更新失败"+err.Error(), CodeError, strs)(Error)
		return
	}
	if len(strs) > 0 {
		Response(ctx)("更新成功", CodeSuccess, strs)(OK)
	}
}

// 同步密码线充-多套餐价格
func HandleSyncPlacesPriceByPcl(ctx *gin.Context) {
	//var strs []string
	param := &struct {
		Cookie string `form:"cookie"`
		//Cookie string `json:"cookie"`
	}{}
	dingo.ErrorIf(ctx.ShouldBindQuery(param)).Unwrap()
	//path := fmt.Sprintf("./data/prices/%d/%s", 12, time.Now().Format("20060102150405"))
	ids := []int{112, 769, 1015}
	//for _,id := range ids {
	//	url := "http://mng.yundian.ink/mng/10041/dynamic/pcl/1/place/virtualProduct/list.data"
	//	client := resty.New()
	//	m := map[string]string{}
	//	m["page"] = strconv.Itoa(1)
	//	m["limit"] = strconv.Itoa(10)
	//	m["placeId"] = strconv.Itoa(id)
	//	m["deviceTypeId"] = strconv.Itoa(12)
	//	resp, err := client.R().
	//		SetHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8").
	//		SetFormData(m).
	//		SetHeader("Cookie", param.Cookie).
	//		Post(url)
	//	if err != nil {
	//		Response(ctx)("更新失败1" + err.Error(), CodeError, strs)(Error)
	//		return
	//	}
	//	// 创建
	//	err = helper.MakeDir(path)
	//	if err != nil {
	//		Response(ctx)("更新失败3" + err.Error(), CodeError, strs)(Error)
	//		return
	//	}
	//	err = ioutil.WriteFile(path + fmt.Sprintf("/%d.json",id),resp.Body(),666)
	//	if err != nil {
	//		Response(ctx)("更新失败4" + err.Error(), CodeError, strs)(Error)
	//		return
	//	}
	//}

	// 入库
	path := fmt.Sprintf("./data/prices/%d/%s", 12, "20210318105155")
	for _, id := range ids {
		lists := new(pclPrice)
		viper.SetConfigFile(path + fmt.Sprintf("/%d.json", id))
		if err := viper.ReadInConfig(); err != nil {
			log.Fatal("viper.ReadInConfig failed : ", err.Error())
		}
		// 反序列化到struct
		if err := viper.Unmarshal(lists); err != nil {
			log.Fatal("viper.Unmarshal failed : ", err.Error())
		}

		// 写入数据库
		var ucount, ccount int
		for _, lst := range lists.Body.Data {
			m := &prices.PriceModel{
				ProductId:        lst.ID,
				DeviceTypeId:     12,
				PlaceId:          id,
				UseDuration:      0,
				PayMoney:         0,
				SetMealNum:       0,
				Status:           0,
				RuleName:         "",
				IsRecommend:      0,
				Priority:         0,
				Deposit:          0,
				BaseTimes:        0,
				BasePrice:        0,
				PayInterval:      0,
				PayIntervalPrice: 0,
				FreeTimes:        0,
				MaxTime:          0,
				MaxPayPrice:      0,
				PayTactics:       0,
				CreateAt:         0,
			}

			// 查询 库中是否存在此数据
			var count int64
			global.Orm.Table("members").Where("uuid = ?", lst.ID).Count(&count)
			if count > 0 {
				ucount++
				global.Orm.Table("members").Where("uuid = ?", lst.ID).Model(&m).Updates(m)
			} else { // 新增
				ccount++
				global.Orm.Table("members").Create(m)
			}
		}
		//str := fmt.Sprintf("当前页-%d,新增%d条,更新%d条 \n", i, ccount, ucount)

	}
}

type placeId struct {
	Id int `gorm:"column:id" json:"id"`
}

// 同步密码线充的价格
func HandleSyncPlacesPrice(ctx *gin.Context) {
	var err error
	param := &struct {
		//Cookie string `form:"cookie"`
		Cookie string `json:"cookie"`
	}{}
	dingo.ErrorIf(ctx.ShouldBindJSON(param)).Unwrap()

	var lists []placeId
	//sql := `select distinct product_id,place_id from orders WHERE date_sub(curdate(), interval 30 day) <= DATE_FORMAT(FROM_UNIXTIME(create_at),'%Y-%m-%d')`
	sql := `select id from places where id >= 885`
	global.Orm.Debug().Raw(sql).Find(&lists)

	//var count int64
	//path := fmt.Sprintf("./data/prices/%d/%s", 10, "20210318004315")
	path := fmt.Sprintf("./data/prices/%d/%s", 10, time.Now().Format("20060102150405"))

	// 抓取
	for _, lst := range lists {
		url := fmt.Sprintf("http://mng.yundian.ink/mng/10041/dynamic/pcl/2/place/virtualProduct.html?deviceTypeId=10&placeId=%d", lst.Id)

		err = logic.NewSyncLogic().DoRequestPrices(lst.Id, url, path, param.Cookie) // 抓取订单信息
		if err != nil {
			log.Println(err)
		}
		//count = 0
		//sql = `select count(1) from prices where product_id = ?`
		//global.Orm.Raw(sql, lst.ProductId).Find(&count)
		//if count == 0 { // prices 表中没有product_id
		//	// 通过设备类型去抓取商户的价格页面
		//	url := fmt.Sprintf("http://mng.yundian.ink/mng/10041/dynamic/pcl/2/place/virtualProduct.html?deviceTypeId=10&placeId=%d", lst.PlaceId)
		//
		//	err = logic.NewSyncLogic().DoRequestPrices(lst.PlaceId, url, path, param.Cookie) // 抓取订单信息
		//	if err != nil {
		//		log.Println(err)
		//	}
		//	// 112 769 1015
		//	// http://mng.yundian.ink/mng/10041/dynamic/pcl/2/place/virtualProduct.html?deviceTypeId=10&placeId=1224
		//	// http://mng.yundian.ink/mng/10041/dynamic/pcl/1/place/virtualProduct.html?deviceTypeId=12&placeId=769
		//	// http://mng.yundian.ink/mng/10041/dynamic/cdb/2/place/virtualProduct.html?deviceTypeId=11&placeId=211
		//}
	}
	var strs []string
	// 入库
	for _, lst := range lists {
		b, _ := ioutil.ReadFile(path + fmt.Sprintf("/%d.html", lst.Id))
		m := logic.NewSyncLogic().GetAttr(string(b), "", lst.Id)
		if m != nil {
			global.Orm.Table("prices").Create(m)
			strs = append(strs, fmt.Sprintf("商户%d价格新增成功", lst.Id))
		}
	}
	Response(ctx)("更新成功", CodeSuccess, strs)(OK)
}

type ResOrderSync struct {
	PlaceId    int    `gorm:"column:place_id" json:"placeId"`
	SharedMode string `gorm:"column:shared_mode" json:"sharedMode"`
	ProductId  string `gorm:"column:product_id" json:"productId"`
}

// 同步充电宝的商户价格

type resultResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

type pclPrice struct {
	Code int `json:"code"`
	Body struct {
		Total int `json:"total"`
		Data  []struct {
			ID          string `json:"id"`
			Content     string `json:"content"`
			Createdate  string `json:"createDate"`
			Priority    int    `json:"priority"`
			Statusname  string `json:"statusName"`
			Isrecommend bool   `json:"isRecommend"`
		} `json:"data"`
	} `json:"body"`
}

type ordertoSql struct {
	Appid  string `gorm:"column:appid" json:"-"`  // Appid
	Mchid  string `gorm:"column:mchid" json:"-"`  // 商户ID
	Openid string `gorm:"column:openid" json:"-"` // openid

	TradeNo    string `gorm:"column:trade_no" json:"tradeNo"`        // 商户订单号
	OutTradeNo string `gorm:"column:out_trade_no" json:"outTradeNo"` // 第三方订单号
	TradeType  string `gorm:"column:trade_type" json:"tradeType"`    // 第三方订单类型 PreAuthPay:预授权 Normal:普通支付(押金支付)
	// 第三方交易状态 微信免押：CREATED 商户已创建服务订单  DOING 服务订单进行中 DONE 服务订单完成 REVOKED 商户取消服务订单 EXPIRED 服务订单已失效
	// 第三方交易状态 微信押金：SUCCESS 支付成功
	// 第三方交易状态 支付宝：
	TradeState      string `gorm:"column:trade_state" json:"tradeState"`
	TradeStateDoing string `gorm:"column:trade_state_doing" json:"tradeStateDoing"`
	// 第三方交易状态 微信免押-doing状态下：USER_CONFIRM：用户确认  MCH_COMPLETE：商户完结
	TradeStateDesc string `gorm:"column:trade_state_desc" json:"tradeStateDesc"` // 第三方交易状态描述
	State          int8   `gorm:"column:state" json:"state"`                     // 商户平台订单状态 1:等待下单2:使用中3:已撤销4:交易失败5:已完成6:支付超时7:待守约10:已删除

	Title string `gorm:"column:title" json:"title"` // 订单标题

	DeviceSn   string `gorm:"column:device_sn" json:"deviceSn"`     // 设备标识
	SharedMode string `gorm:"column:shared_mode" json:"sharedMode"` // 设备共享模型  pcl密码线充 cdb充电宝
	FeeMode    int8   `gorm:"column:fee_mode" json:"feeMode"`       // 设备费用模型  2:预付费  1:普通

	Money              int64  `gorm:"column:money" json:"-"`                      // 订单总金额 - 单位分
	MoneyStr           string `gorm:"column:money_str" json:"moneyStr"`           //
	PayMoney           int64  `gorm:"column:pay_money" json:"-"`                  // 支付金额 - 单位分
	PayMoneyStr        string `gorm:"column:pay_money_str" json:"payMoneyStr"`    //
	RefundMoney        int64  `gorm:"column:refund_money" json:"refundMoney"`     // 退款金额 - 单位分
	SettlementWay      int8   `gorm:"column:settlement_way" json:"settlementWay"` // 结算方式 1: 微信支付
	SettlementMoney    int64  `gorm:"column:settlement_money" json:"-"`           // 结算金额
	SettlementMoneyStr string `gorm:"column:settlement_money_str" json:"settlementMoneyStr"`
	SettlementState    int8   `gorm:"column:settlement_state" json:"settlementState"` // 结算状态 1:未结算 2:结算中 3:已结算

	CouponType     int8   `gorm:"column:coupon_type" json:"couponType"`
	CouponMoney    int64  `gorm:"column:coupon_money" json:"-"`
	CouponMoneyStr string `gorm:"column:coupon_money_str" json:"couponMoneyStr"`

	OrderFrom string `gorm:"column:order_from" json:"orderFrom"` // 订单来源 weixin zhifubao
	PayFrom   int8   `gorm:"column:pay_from" json:"payFrom"`     // 支付来源 1免押 2押金
	PayType   int8   `gorm:"column:pay_type" json:"payType"`     // 支付类型 3:微信支付

	PlaceId    int    `gorm:"column:place_id" json:"placeId"`       // 网点ID
	PlaceName  string `gorm:"column:place_name" json:"placeName"`   // 网点名
	MemberId   string `gorm:"column:member_id" json:"memberId"`     // 会员ID
	MemberName string `gorm:"column:member_name" json:"memberName"` // 会员名
	UserId     int    `gorm:"column:user_id" json:"userId"`         // 代理商ID
	UserName   string `gorm:"column:user_name" json:"userName"`

	OvertimeState int8 `gorm:"column:overtime_state" json:"overtime_state"` // 充电宝超时状态 1:正常 2:超时
	IsDelete      int8 `gorm:"column:is_delete" json:"-"`                   // 是否删除 默认0 1:删除
	IsDraw        int8 `gorm:"column:is_draw" json:"isDraw"`                // 是否抽单 默认0 1:抽单

	PayAt    dingo.Time `gorm:"column:pay_at" json:"payAt"`
	CreateAt dingo.Time `gorm:"column:create_at" json:"createAt"`
	UpdateAt dingo.Time `gorm:"column:update_at" json:"updateAt"`
	RefundAt dingo.Time `gorm:"column:refund_at" json:"-"`
	EndAt    dingo.Time `gorm:"column:end_at" json:"endAt"`
	DeleteAt dingo.Time `gorm:"column:delete_at" json:"-"`
	DrawAt   dingo.Time `gorm:"column:draw_at" json:"-"`

	// 新增
	ParentId       int    `gorm:"parent_id" json:"parentId"`   // 父ID 抽单订单抽给哪个代理商
	ProductId      string `gorm:"product_id" json:"productId"` // 产生订单时的产品价格(商户对应的价格)
	UserNo         string `gorm:"-" json:"userNo"`             // 用户编号
	MaintainerName string `gorm:"-" json:"maintainerName"`     // 维护者

	IsTianHai int8 `gorm:"column:is_tianhai" json:"-"` // 是否是天海的订单，定时任务用
}
